import instance from "@/utils/http";

export function getLoop(number) {
    return instance.get(`/api/weChat/applet/course/banner/list?number=${number}`)
}

export function getList(type,number,pageSize){
    let params = new URLSearchParams()
    params.append("type", type)
    params.append("pageNum", number)
    params.append("pageSize", pageSize)
    return instance.post(`/api/weChat/applet/course/list/type`, params)
}

// 获取某个课程的详情信息
export function getCourseDetail(courseId) {
    return instance.get(`/api/pc/course/detail/${courseId}`)
}
// 搜索专题
// 获取课程分类信息
export function getSubjectlist(data={}) {
    return instance.post(`/api/weChat/applet/subject/list`, data)
}

//搜索
export function getSubjectBody(pageNum, pageSize, type, subjectId, keyword, courseType) {
    return instance.get(`/api/pc/course/search/keyword?pageNum=${pageNum}&pageSize=${pageSize}&type=${type}&keyword=${keyword}&subjectId=${subjectId}&courseType=${courseType}`)
}
//登录
export function getLoginInfo(username, password) {
    let params = new URLSearchParams
    params.append("username", username)
    params.append("password", password)
    params.append("rememberMe", false)
    return instance.post(`/api/pcUser/login`, params)
}

export function logout(){
    // /pcUser/logout
    return instance.get(`/api/pcUser/logout`)
}